﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace GTSDemo.Views
{
    /// <summary>
    /// Interaction logic for SignalOutput.xaml
    /// </summary>
    public partial class SignalOutput : UserControl
    {
        public SignalOutput()
        {
            InitializeComponent();
        }
        public string SignalName
        {
            get { return (string)GetValue(SignalNameProperty); }
            set { SetValue(SignalNameProperty, value); }
        }

        // Using a DependencyProperty as the backing store for SignalName.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty SignalNameProperty =
            DependencyProperty.Register("SignalName", typeof(string), typeof(SignalOutput), new PropertyMetadata("SignalName"));
        public bool IsOn { get; set; } = false;
        public event RoutedEventHandler CheckChanged;

        private void CheckButton_Click(object sender, RoutedEventArgs e)
        {
            var checkBox = sender as CheckBox;
            if (checkBox == null) return;
            IsOn = checkBox.IsChecked.Value;
            CheckChanged?.Invoke(this, e);
        }
    }
}
